/*
 * tools.c
 *
 *  Created on: 06.06.2009
 *      Author: Admin
 */


#include "tools.h"

const char * StPrintI(const char * format, const int num){
	static char temp[50]="";
	sprintf(temp, format, num);
	return temp;
}


int SetDigit(const int where, const int number, const int what){
int temp=
	int(	(fmod(where,pow(10,number))-
			fmod(where,pow(10,(number-1))))
			/pow(10,(number-1)));
return int( where - (temp*pow(10,(number-1))) + (what* pow(10,(number-1))) );

	//div_t temp;
//	temp=div()
}
/**************************************************************************************/
//
//          it provides "from midnight seconds" to hours,minutes,seconds
//
/*************************************************************************************/

int UTCTimeToHours ( const float t)
{
	int res;
	res=(int)((t)/3600);
	return res;
}

int UTCTimeToMinutes ( const float t)
{
	int res,hour;
	hour=(int)(t/3600);
	res=(int)((t-(hour*3600))/60);
	return res;
}

int UTCTimeToSeconds ( const float t)
{
	int hour,min,res;
	hour=(int)(t/3600);
	min=(int)((t-(hour*3600))/60);
	res=(int)(t-(hour*3600)-(min*60));
	return res;
}




/**************************************************************************************/
//
//          end of "from midnight seconds" to hours,minutes,seconds
//
/*************************************************************************************/
